package tianqi.service.shop.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import tianqi.Dao.shop.AddrDao;
import tianqi.entity.Addr;
import tianqi.entity.UserY;
import tianqi.service.shop.BalanceService;
@Service
public class BalanceServiceImpl implements BalanceService {

	@Autowired
	private AddrDao addrDao;
	
	@Override
	public List<Addr> queryAddrByUid(UserY u) {
		
		return addrDao.queryAddrByUid(u);
	}

	@Override
	public void saveAddr(Addr addr) {
		if (addr.getIsdefault().equals("1")) {
			addrDao.updateIsDefault(addr.getUserid());
		}
		addrDao.saveAddr(addr);
	}

}
